-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pallet-revive] last call return data API #5779
Conversation
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
bot fmt |
@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7398794 was started for your command Comment |
@xermicus Command |
@xermicus Command |
substrate/frame/revive/src/exec.rs
Outdated
} else { | ||
Self::transfer_no_contract(&origin, &dest, value) | ||
Self::transfer_no_contract(&origin, &dest, value).map(|_| Default::default()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this already return ExecResult
? No map necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep good catch, fixed.
) -> ExecResult { | ||
) -> Result<(), ExecError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The returned output is now attached to the frame, so we can't return it anymore, or am I missing something?
… drop early Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: xermicus <cyrill@parity.io>
This reverts commit b6c3705.
Signed-off-by: xermicus <cyrill@parity.io>
bot fmt |
@xermicus https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7432068 was started for your command Comment |
@xermicus Command |
Co-authored-by: PG Herveou <pgherveou@gmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
This PR introduces 2 new syscalls:
return_data_size
andreturn_data_copy
, resembling the semantics of the EVMRETURNDATASIZE
andRETURNDATACOPY
opcodes.The ownership of
ExecReturnValue
(the return data) has moved to theFrame
. This allows implementing the new contract API functionality in ext with no additional copies. Returned data is passed via contract memory, memory is (will be) metered, hence the amount of returned data can not be statically known, so we should avoid storing copies of the returned data if we can. By moving the ownership of the exectuables return value into theFrame
struct we achieve this.A zero-copy implementation of those APIs would be technically possible without that internal change by making the callsite in the runtime responsible for moving the returned data into the frame after any call. However, resetting the stored output needs to be handled in ext, since plain transfers will not affect the stored return data (and we don't want to handle this special call case inside the
runtime
API). This has drawbacks:Frame
, both can be handled in a single place. Handling both infn run()
is more natural and leaves less room for runtime API bugs.The returned output is reset each time before running any executable in a nested stack. This change should not incur any overhead to the overall memory usage as only the returned data from the last executed frame will be kept around at any time.